<?php
namespace App\Http\Controllers\Admin;
use \App\Http\Controllers;
use App\Models\Admin;
use Gregwar\Captcha\CaptchaBuilder;

Class LoginController extends BaseController{

    public function __construct(Admin $admin)
    {
        $this->admin = $admin;
    }

    /**
     * 验证码
     */
    public function getcaptcha(){
        $builder = new CaptchaBuilder();
        $builder->build(100,32);

        $phrase = $builder->getPhrase();
        //把内容存入session
        addsession('vcode',$phrase);
        ob_clean(); //清除缓存
        return response($builder->output())->header('Content-type','image/jpeg');
    }

    /**
     * 返回登录页视图
     */
    public function getLogin(){
          return view('admin.login.login');
    }

    /**
     * 登录处理
     */
    public function postdoLogin(){
          $res = $this->admin->doLogin();
          echo $res;
    }

    /**
     *
     */


}